package com.demo.feifan.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.demo.feifan.annotation.DynamicDataSource;
import com.demo.feifan.entity.Test1;
import com.demo.feifan.mapper.TestMapper;
import com.demo.feifan.service.TestService;
import lombok.RequiredArgsConstructor;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
// 指定使用ClickHouse数据源

@RequiredArgsConstructor
public class TestServiceImpl extends ServiceImpl<TestMapper, Test1> implements TestService {
    // 可以在这里添加自定义的业务实现方法


    private final TestMapper testMapper;
    @DynamicDataSource("clickhouse")
    @Override
    public int insertBatch(@Param("list") List<Test1> list) {
        return testMapper.insertBatch(list);
    }
}
